David Himmelstrup’s reanimate
package provides a library for generating animations programatically. I wanted to use it on Windows 10, but hit a dead end. However, I had better luck with Windows Subsystem for Linux (WSL) 2 and Ubuntu 20.04 LTS.
GSL and linear algebra
reanimate
depends on the hmatrix
package, which, in turn, requires the GNU Scientific Library (GSL) and LAPACK (Linear Algebra PACKage).
Following instructions for hmatrix, I installed Ubuntu packages libgsl0-dev
, liblapack-dev
and libatlas-base-dev
. libgsl0-dev
is a virtual package, provided by libgsl-dev
, the GNU Scientific Library (GSL) — development package. liblapack-dev
is the library of linear algebra routines 3 (static version). libatlas-base-dev
is Automatically Tuned Linear Algebra Software, generic static.
1 |
sudo apt install libgsl0-dev liblapack-dev libatlas-base-dev |
FFmpeg
reanimate
uses FFmpeg
to render to a file. I installed the Ubuntu package ffmpeg
, providing tools for transcoding, streaming and playing of multimedia files.
1 |
sudo apt install ffmpeg |
Hello, world
My first, test, program was based on William Yeo’s tutorial. Using the Haskell Tool Stack’s lts-16.3
resolver (GHC 8.8.3) and a dependency on reanimate
, I could build executable ra-test
with stack
.
1 2 3 4 5 6 7 |
module Main where import Reanimate import Reanimate.Builtin.Documentation main :: IO () main = reanimate (docEnv (drawBox `parA` drawCircle)) |
In WSL 2, I could execute ra-test
to render to a Graphics Interchange Format (GIF) file.
1 2 3 4 5 6 7 8 9 10 11 12 |
$ stack exec -- ra-test render --format gif -o ra-test.gif Animation options: fps: 25 width: 320 height: 180 fmt: gif target: /home/mpilgrem/code/haskell/ra-test/ra-test.gif raster: RasterNone Starting render of animation: 2.0 Frames rendered: 50/50, time spent: 0s $ explorer.exe ra-test.gif |
The output was as expected: an animation of a box (drawBox
) and an animation of a circle (drawCircle
), played concurrently (parA
) and with a default environment (docEnv
).
Windows 10, version 2004
So, what about reanimator
on Windows 10, version 2004? My experience could be summed up as: thwarted at every turn.
hmatrix
I managed, I think, to build hmatrix
on Windows 10. It required the OpenBLAS library, setting the flag openblas
, setting --extra-include-dirs
to the OpenBLAS include
folder and --extra-lib-dirs
to the OpenBLAS bin
folder, and setting –extra-lib-dirs to the gcc folder under MSYS2 (C:\msys64\usr\lib\gcc\x86_64-pc-msys\9.1.0
).
Getting the OpenBLAS library itself involved downloading and extracting OpenBLAS 0.3.10 version.zip
, and (in that folder) using the MSYS2 commands: make clean
, make
, make install
. This generated the OpenBLAS folder under MSYS2 (C:\msys64\opt\OpenBLAS
). Prequisites were the MSYS2 packages make
, perl
and gcc-fortran
.